namespace AssetsSys.model.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class foreigKey : DbMigration
    {
        public override void Up()
        {
            DropIndex("dbo.Fixups", new[] { "FixUsers_Id" });
            DropIndex("dbo.Fixups", new[] { "RepairUsers_Id" });
            DropIndex("dbo.Modifies", new[] { "AcceptUsers_Id" });
            DropIndex("dbo.Modifies", new[] { "ModifyUsers_Id" });
            DropColumn("dbo.Fixups", "FixId");
            DropColumn("dbo.Fixups", "RepairId");
            DropColumn("dbo.Modifies", "AcceptId");
            DropColumn("dbo.Modifies", "ModifyId");
            RenameColumn(table: "dbo.Fixups", name: "FixUsers_Id", newName: "FixId");
            RenameColumn(table: "dbo.Fixups", name: "RepairUsers_Id", newName: "RepairId");
            RenameColumn(table: "dbo.Modifies", name: "AcceptUsers_Id", newName: "AcceptId");
            RenameColumn(table: "dbo.Modifies", name: "ModifyUsers_Id", newName: "ModifyId");
            AddColumn("dbo.Fixups", "OldStateId", c => c.Guid(nullable: false));
            AddColumn("dbo.Fixups", "NewStateId", c => c.Guid(nullable: false));
            AddColumn("dbo.Fixups", "ModifyDescribe", c => c.String());
            AddColumn("dbo.Modifies", "OldStateId", c => c.Guid(nullable: false));
            AddColumn("dbo.Modifies", "NewStateId", c => c.Guid(nullable: false));
            AddColumn("dbo.Modifies", "ModifyDescribe", c => c.String());
            AlterColumn("dbo.Fixups", "RepairId", c => c.Guid(nullable: false));
            AlterColumn("dbo.Fixups", "FixId", c => c.Guid(nullable: false));
            AlterColumn("dbo.Fixups", "FixId", c => c.Guid(nullable: false));
            AlterColumn("dbo.Fixups", "RepairId", c => c.Guid(nullable: false));
            AlterColumn("dbo.Modifies", "AcceptId", c => c.Guid(nullable: false));
            AlterColumn("dbo.Modifies", "ModifyId", c => c.Guid(nullable: false));
            AlterColumn("dbo.Modifies", "AcceptId", c => c.Guid(nullable: false));
            AlterColumn("dbo.Modifies", "ModifyId", c => c.Guid(nullable: false));
            CreateIndex("dbo.Fixups", "OldStateId");
            CreateIndex("dbo.Fixups", "NewStateId");
            CreateIndex("dbo.Fixups", "RepairId");
            CreateIndex("dbo.Fixups", "FixId");
            CreateIndex("dbo.Modifies", "OldStateId");
            CreateIndex("dbo.Modifies", "NewStateId");
            CreateIndex("dbo.Modifies", "AcceptId");
            CreateIndex("dbo.Modifies", "ModifyId");
            AddForeignKey("dbo.Fixups", "NewStateId", "dbo.Status", "Id");
            AddForeignKey("dbo.Fixups", "OldStateId", "dbo.Status", "Id");
            AddForeignKey("dbo.Modifies", "NewStateId", "dbo.Status", "Id");
            AddForeignKey("dbo.Modifies", "OldStateId", "dbo.Status", "Id");
            DropColumn("dbo.Fixups", "OldState");
            DropColumn("dbo.Fixups", "NewState");
            DropColumn("dbo.Modifies", "OldState");
            DropColumn("dbo.Modifies", "NewState");
        }
        
        public override void Down()
        {
            AddColumn("dbo.Modifies", "NewState", c => c.String());
            AddColumn("dbo.Modifies", "OldState", c => c.String());
            AddColumn("dbo.Fixups", "NewState", c => c.String());
            AddColumn("dbo.Fixups", "OldState", c => c.String());
            DropForeignKey("dbo.Modifies", "OldStateId", "dbo.Status");
            DropForeignKey("dbo.Modifies", "NewStateId", "dbo.Status");
            DropForeignKey("dbo.Fixups", "OldStateId", "dbo.Status");
            DropForeignKey("dbo.Fixups", "NewStateId", "dbo.Status");
            DropIndex("dbo.Modifies", new[] { "ModifyId" });
            DropIndex("dbo.Modifies", new[] { "AcceptId" });
            DropIndex("dbo.Modifies", new[] { "NewStateId" });
            DropIndex("dbo.Modifies", new[] { "OldStateId" });
            DropIndex("dbo.Fixups", new[] { "FixId" });
            DropIndex("dbo.Fixups", new[] { "RepairId" });
            DropIndex("dbo.Fixups", new[] { "NewStateId" });
            DropIndex("dbo.Fixups", new[] { "OldStateId" });
            AlterColumn("dbo.Modifies", "ModifyId", c => c.Guid());
            AlterColumn("dbo.Modifies", "AcceptId", c => c.Guid());
            AlterColumn("dbo.Modifies", "ModifyId", c => c.String());
            AlterColumn("dbo.Modifies", "AcceptId", c => c.String());
            AlterColumn("dbo.Fixups", "RepairId", c => c.Guid());
            AlterColumn("dbo.Fixups", "FixId", c => c.Guid());
            AlterColumn("dbo.Fixups", "FixId", c => c.String());
            AlterColumn("dbo.Fixups", "RepairId", c => c.String());
            DropColumn("dbo.Modifies", "ModifyDescribe");
            DropColumn("dbo.Modifies", "NewStateId");
            DropColumn("dbo.Modifies", "OldStateId");
            DropColumn("dbo.Fixups", "ModifyDescribe");
            DropColumn("dbo.Fixups", "NewStateId");
            DropColumn("dbo.Fixups", "OldStateId");
            RenameColumn(table: "dbo.Modifies", name: "ModifyId", newName: "ModifyUsers_Id");
            RenameColumn(table: "dbo.Modifies", name: "AcceptId", newName: "AcceptUsers_Id");
            RenameColumn(table: "dbo.Fixups", name: "RepairId", newName: "RepairUsers_Id");
            RenameColumn(table: "dbo.Fixups", name: "FixId", newName: "FixUsers_Id");
            AddColumn("dbo.Modifies", "ModifyId", c => c.String());
            AddColumn("dbo.Modifies", "AcceptId", c => c.String());
            AddColumn("dbo.Fixups", "RepairId", c => c.String());
            AddColumn("dbo.Fixups", "FixId", c => c.String());
            CreateIndex("dbo.Modifies", "ModifyUsers_Id");
            CreateIndex("dbo.Modifies", "AcceptUsers_Id");
            CreateIndex("dbo.Fixups", "RepairUsers_Id");
            CreateIndex("dbo.Fixups", "FixUsers_Id");
        }
    }
}
